Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
dot-env-json
Advanced tools
Package similar to dotenv to read from .json files. It looks for files based on NODE_ENV. Ex: .env.development.json
import dotenv from "dotenvJson";
dotenv();
node -r dotenvJson/config
# change base directory from root
node -r dotenvJson/config dotenv_config_base=config/
Accepts an options object. Only valid option currently is base which sets the base path to look for files.
import dotenv from "dotenvJson";
# approot/config/.env.development.json
dotenv({
base: "config/"
});
Since this package uses NODE_ENV it is recommended to use the cross-env package to set the environment in your run scripts.
# gets the json file approot/env.test.json
cross-env NODE_ENV=test node -r dotenvJson/config yourfile.js
# gets the json file approot/config/env.development.json
cross-env NODE_ENV=development node -r dotenvJson/config dotenv_config_base=config/ yourfile.js
FAQs
package similar to dotenv that reads from JSON file.
We found that dot-env-json demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.